<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <lay_head :msgs="msg" @test="add"></lay_head>

    </div>
    <script>
        Vue.component("lay_head",{
            props:['msgs','test'], 
            template:`
                <div>
                    <div>{{msgs}}</div>
                    <button @click="del">按钮</button>
                </div> 
            
            `,
            methods:{
                del(){
                    console.log("ok");
                    console.log(this)
                    this.$emit("test",{name:"Msea",age:"18"})
                }
            }
        })
    new Vue({
        el:"#app",
        data:{
            msg:"亲亲凄凄惨惨戚戚"
        },
        methods: {
            add(val){
                console.log(val)
            }
            
        },
    })
    </script>
    
</body>
</html>